<?php
/**
 * Created by PhpStorm.
 * User: 王新宇
 * Date: 2021/11/18
 * Time: 11:21
 */
namespace app\admin\model;

use think\Model;

class Category extends Model
{
    public static function getCategory ()
    {
        $arr = Category::where('parentid','=','0')->select()->toArray();
           foreach ($arr as $k=>$v){
               $data= Category::where('parentid','=',$v['id'])->select()->toArray();
               $arr[$k]['data']=$data;
           }
        return $arr;
    }
}